package week13;

import java.util.ArrayList;

public class AdminPerson extends Person{
    public AdminPerson(){
    }

    public AdminPerson(String name, int money) {
        super(name, money);
    }
    public ArrayList<Integer>sendMoney(int totalMoney,int count){
        ArrayList<Integer>redList=new ArrayList<>();
        int leftMonet=super.getMoney();
        if (leftMonet<totalMoney){
            System.out.println("卡上余额不足");
            return redList;
        }
        super.setMoney(leftMonet-totalMoney);
        int avg=totalMoney/count;
        int mod=totalMoney%count;
        for (int i = 0; i <(count-1) ; i++) {
            redList.add(avg);
        }
        int last=avg+mod;
        redList.add(last);
        return redList;
    }
}
